<?php
if(!defined('IN_CORE')) exit('permission deny');

/**
 * 
 * debug调试类
 * @author zhupp 20110823
 *
 */
class debug {
	private static $debug = false;
	private static $filename = '';
	private static $sep = "\t\t"; //分割符

	/**
     * init 载入调试模式和调试文件的路径
     *
     * @set $debug $filename
     */
	public static function init() {
		self::$debug = defined('DEBUG_MODE') ? DEBUG_MODE : false;
		self::$filename = defined('DEBUG_FILENAME') ? DEBUG_FILENAME : './debug.txt';
	}
	
	public static function write($msg,$filename=DEBUG_FILENAME) {
		if(self::$debug)
			file_put_contents($filename, date('Y-m-d H:i:s').self::$sep.$msg.PHP_EOL,FILE_APPEND);
	}

	public static function output($msg) {
		if(self::$debug) echo $msg.PHP_EOL;
	}
	
	
	
}


?>